<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of customer_model
 *
 * @author Hadi
 */
class quotationlist_model extends Default_My_Model{
    //put your code here
    function __construct() {
        parent::__construct();
    }
    
     public function getQuotationlist($whr){
        $QUERY = "SELECT id_quotation, nomor_quotation, diskon FROM data_quotation_to_cust ".($whr ? " WHERE $whr " : "")."  order by id_quotation desc";
        return $this->db->query($QUERY);
    }
    
    public function getDetailQuotationlist($kode){
         $QUERY = "SELECT q.id_quotation as list_quotation_id, q.nomor_quotation, c.* FROM data_quotation_to_cust q LEFT JOIN master_customer c
                ON q.id_customer = c.id_customer
            WHERE q.id_quotation = '$kode' order by q.id_quotation desc";
        return $this->get_object($QUERY);
    }
    
    public function getItem($id_quotation){
        return $this->db->query("SELECT i.id_item, i.nama_item, i.satuan_beli, i.quantity, i.harga_beli, i.harga_beli_dollar, i.harga_jual, i.harga_jual_dollar
                                 FROM data_quotation_to_cust_item i LEFT JOIN data_quotation_to_cust q ON i.id_quotation = q.id_quotation
                                 WHERE q.id_quotation = ?", array($id_quotation));
    }
    
}

?>
